import mallApi from "@/api/declaration/mall/mallApi"
import httpRequest from "@/config/axios/httpRequest"
import { CommentModel } from "@/models/mall/CommentModel"

// 查询商品评论列表
export const getCommentPage = async (params) => {
  return await httpRequest.get(mallApi.GetCommentPage, { params })
}

// 查询商品评论详情
export const getComment = async (id: number) => {
  return await httpRequest.get(mallApi.GetComment, { params: { id } })
}

// 添加自评
export const createComment = async (data: CommentModel) => {
  return await httpRequest.post(mallApi.CreateComment, data)
}

// 显示 / 隐藏评论
export const updateCommentVisible = async (data: any) => {
  return await httpRequest.put(mallApi.UpdateCommentVisible, data)
}

// 商家回复
export const replyComment = async (data: any) => {
  return await httpRequest.put(mallApi.ReplyComment, data)
}
